define(function(require, exports, module) {
    var mId = 'typeList',
        parType, listData,
        tpl = require("{view}typeList.tpl"),
        view = {

            template: _.template(tpl),

            render: function() {
                parType = share.getParameter().type || 1;
                listData = util.getLocalStorage('type').data[parType];
                if ($('#' + mId).attr('type') == listData) {
                    // share.showPage(mId)
                } else {
                    window.scrollTo(0, 0);
                    $('#' + mId).remove();
                    $("body").append(this.template(listData));
                    this.bindEvt();
                }
                share.showPage(mId);
                this.reload();
            },
            reload: function() {
                var dom = $('#' + mId),
                    play = window.controller.play.play;
                if (play) dom.find('.ico_music_animate').addClass('selected');
                else dom.find('.ico_music_animate').removeClass('selected');
            },
            bindEvt: function() {
                var dom = $("#" + mId);

                dom.find('.back').on('tap', function() {
                    window.location.href = '#found'
                });

                dom.find('.ico_music_animate').on('tap', function() {
                    var songid = $('#play').attr('songid');
                    var type = $('#play').attr('type');

                    songid || (songid = 246946436);

                    window.location.href = '#play?songid=' + songid + '&type=' + type;
                });

                dom.find('.ico_attention').on('tap', function() {
                    $(this).find('.triangle').toggle();
                    $(this).parent().find('.info').toggle();
                });
                // ico_attention
                dom.find('.line').on('tap', function() {
                    var songid = $(this).attr('songid'),
                        type = $(this).attr('type');
                    util.setLocalStorage('play_list', listData);
                    // console.log(listData)
                    window.location.href = '#play?songid=' + songid;
                })
            },
        };
    view.userNav = false;
    module.exports = view;
});
